package com.fowo.api.common.util;

import lombok.experimental.UtilityClass;

@UtilityClass
public class HexUtils {
    public String toHexString(byte[] bytes) {
        StringBuilder stringBuilder = new StringBuilder();
        String sTemp;
        for(int i=0; i<bytes.length; i++) {
            sTemp = Integer.toHexString(0xff & bytes[i]);
            if (sTemp.length() < 2) {
                stringBuilder.append('0');
            }
            stringBuilder.append(sTemp.toLowerCase());
        }
        return stringBuilder.toString();
    }
}
